home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / explor2a / makeprop.cls < prev    next >
Text File  |  1999-09-27  |  3KB  |  96 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "MakeProper"
  6. Attribute VB_GlobalNameSpace = False
  7. Attribute VB_Creatable = True
  8. Attribute VB_PredeclaredId = False
  9. Attribute VB_Exposed = False
  10.  
  11. Public Function RemoveFileExtension(Filename As String) As String
  12.  
  13.     If Filename = "" Then Exit Function
  14.     
  15.     For i = Len(Filename) To 1 Step -1
  16.     
  17.         If Mid(Filename, i, 1) = "." Then
  18.             RemoveFileExtension = Mid(Filename, 1, i - 1)
  19.             Exit Function
  20.         End If
  21.     
  22.     RemoveFileExtension = Filename
  23.     
  24.     Next i
  25.        
  26. End Function
  27. Public Function GetFileExtension(Filename As String) As String
  28.  
  29.     If Filename = "" Then Exit Function
  30.     
  31.     For i = 1 To Len(Filename)
  32.     
  33.         If Mid(Filename, i, 1) = "." Then
  34.             GetFileExtension = Right(Filename, Len(Filename) - i)
  35.             Exit Function
  36.         End If
  37.     Next i
  38.     
  39.     GetFileExtension = Filename
  40.     
  41. End Function
  42. Public Function MakeFirstLetterUpperCase(Text As String) As String
  43.  
  44.     If Text = "" Then Exit Function
  45.     
  46.     MakeFirstLetterUpperCase = UCase(Left(Text, 1)) & Right(Text, (Len(Text) - 1))
  47.  
  48. End Function
  49.  
  50. Public Function MakeFirstLetterUpperCaseAllOthersLower(Text As String) As String
  51.  
  52.     If Text = "" Then Exit Function
  53.  
  54.     MakeFirstLetterUpperCaseAllOthersLower = (UCase(Left(Text, 1)) & LCase(Right(Text, (Len(Text) - 1))))
  55.  
  56. End Function
  57.  
  58. Public Function MakeAllFirstLettersCaptial(Text As String) As String
  59.  
  60.     If Text = "" Then Exit Function
  61.  
  62. For i = 1 To Len(Text)
  63.     
  64.     If i = 1 Then Mid(Text, 1, 1) = UCase(Mid(Text, 1, 1)) 'Make sure that the first char is done
  65.     If Mid(Text, i, 1) = " " Then
  66.         Mid(Text, i + 1, 1) = UCase(Mid(Text, i + 1, 1))
  67.     End If
  68.     
  69.     MakeAllFirstLettersCaptial = Text
  70.     
  71. Next i
  72. End Function
  73.  
  74.  
  75. Public Function GetEmailServer(EmailAddress As String) As String
  76.  
  77. If EmailAddress = "" Then Exit Function
  78.  
  79.     For i = Len(EmailAddress) To 1 Step -1
  80.     
  81.     If Mid(EmailAddress, i, 1) = "@" Then 'Get server
  82.         GetEmailServer = Right(EmailAddress, Len(EmailAddress) - i)
  83.         Exit Function
  84.     End If
  85.     
  86.     Next i
  87.     
  88.     GetEmailServer = EmailAddress
  89.     
  90. End Function
  91.  
  92. Public Sub About()
  93.  
  94.     MsgBox "Make Proper v2 Class for Visual Basic." & Chr(13) & Chr(13) & Chr(34) & "If you dont like this code, stick it . . . " & Chr(34) & Chr(13) & Chr(13) & "N Ramsbottom ⌐1999", vbInformation, "About"
  95. End Sub
  96.